package Day7;

public class Point {
    private int x;
    private int y;

    public Point() {

    }

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public Point(int x){
        this(x,x);
    }

    //提供计算两点之间的距离的方法
    public double distance(Point p){
        return Math.sqrt(Math.pow(this.x-p.x,2)+Math.pow(this.y-p.y,2));
    }

    public double distance(int x,int y){
        return this.distance(new Point(x,y));
    }

    //计算当前点到原点的距离
    public double distance(){
        return this.distance(0,0);
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }
}
